<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:useBean id="user_login" scope="session" class="software.Use_user"/>
<%
String Name=null;
String Pwd=null;
Name=request.getParameter("Name");
Pwd=request.getParameter("Pwd");
 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>软件开发讨论平台</title>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  <body>
   <%
   	boolean check=false;
  	if(Name==null||Pwd==null)
  	out.println("没有输入值");
	else  
	{
	user_login.setUsername(Name);
	user_login.setPassword(Pwd);
	if(user_login.Che_Login()){
	 	out.println(Name+"登录成功");
	 	check=true;
	 	session.setAttribute("Namesel",Name);
	 	session.setAttribute("IDsel",user_login.getId());
		response.sendRedirect("selhome_main.jsp");
	}
	else{
	%>
	登录失败，请点击<a href="user_login.jsp">这里</a>重新登录/点击<a href="user_register.jsp">这里</a>注册新用户
	<%} 
	} 
   %>
	<%if(!check){%>
	<form method="post" name="login" action="user_login.jsp">
  	<p>
  	  <input name="Name" value="用户名" size="20" maxlength="20">
  	  <br>
  	  <br>
      <input name="Pwd" value="密码" size="20" maxlength="30" >
    </p>
    <input type="submit" name="Submit" value="提交">
  	<input type="reset" name="Submit2" value="清除">
  	<br>
  </form>
	<%} %>
  </body>
</html>
